package main

import (
	"fmt"
	"runtime"
	"time"
)

var i int

func main() {





	for i := 1; i <= 5; i++ {

		go test(fmt.Sprintf("%s,%d", "协程:", i))
	}

	for i := 1; i <= 5; i++ {

		//Gosched使当前go程放弃处理器，以让其它go程运行。它不会挂起当前go程，因此当前go程未来会恢复执行。
		runtime.Gosched()

		 fmt.Println("hello food")
	}



	time.Sleep(time.Minute)
}

func test(name string) {

	for true {

		fmt.Printf("name is %s , i is %d \n", name, i)

		i++



		time.Sleep(time.Second)
	}
}
